package cc.customer.utils;

import cc.customer.expCustomer.domain.ExEmp;
import cc.customer.aiEmport.damain.CAiEmp;
import cc.customer.bigEmport.damain.BigEmp;
import cc.customer.bigEmport.damain.EprRecords;
import cc.customer.common.utils.Constant;
import cc.customer.myCustomer.damain.CusResource;
import cc.customer.myCustomer.damain.MyCustomer;
import cc.customer.onschool.domain.OnSchoolResource;
import cc.customer.system.domain.MyUser;

import java.util.List;

/**
 * Description: customer
 * Created by yhsh on 2019/12/10 13:29
 * version 2.0
 * 方法说明
 */
public class AutonCusInfo {
	/**大资源**/
	public static BigEmp parseBigEmp(BigEmp bigEmp, MyUser user){
		List<String> list = user.getAllAuthority();
		if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)){
			bigEmp.setBpQq("11****");
			if(!bigEmp.getBpMobile().isEmpty()){
				bigEmp.setBpMobile(parsePhone(bigEmp.getBpMobile()));
			}
			bigEmp.setBpEmail("11******@qq.com");
		}
		return bigEmp;
	}
	/**AI大资源**/
	public static CAiEmp parseCAiEmp(CAiEmp bigEmp, MyUser user){
		List<String> list = user.getAllAuthority();
		if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)){
			if(!bigEmp.getAiMobile().isEmpty()){
				bigEmp.setAiMobile(parsePhone(bigEmp.getAiMobile()));
			}
		}
		return bigEmp;
	}
	/**推广资源**/
	public static ExEmp parseExEmp(ExEmp exEmp,MyUser user){
		List<String> list = user.getAllAuthority();
		if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)){
			exEmp.setcExEmail("11******@qq.com");
			if(!exEmp.getcExMobile().isEmpty()){
				exEmp.setcExMobile(parsePhone(exEmp.getcExMobile()));
			}
			exEmp.setcExWechat("******");
			exEmp.setcExQq("******");
		}
		return exEmp;
	}
	/**个人资源**/
	public static MyCustomer parsePerson(MyCustomer myCustomer,MyUser user){
		List<String> list = user.getAllAuthority();
		if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)){
			myCustomer.setMyCusEmail("11******@qq.com");
			myCustomer.setMyCusWechat("*****");
			if(!myCustomer.getMyCusMobile().isEmpty()){
				myCustomer.setMyCusMobile(parsePhone(myCustomer.getMyCusMobile()));
			}
			myCustomer.setMyCusQq("******");
		}
		return myCustomer;
	}

	/**网校资源**/
	public static OnSchoolResource parseOnSchoolResource(OnSchoolResource onSchoolResource,MyUser user){
		List<String> list = user.getAllAuthority();
		if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)){
			if(!onSchoolResource.getOsMobile().isEmpty()){
				onSchoolResource.setOsMobile(parsePhone(onSchoolResource.getOsMobile()));
			}
			onSchoolResource.setOsEmail("******");
		}
		return onSchoolResource;
	}

	/**大资源导出失败**/
	public static EprRecords parseRecords(EprRecords records,MyUser user){
		List<String> list = user.getAllAuthority();
		if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)){
			records.setcEprPhone("*******");
		}
		return records;
	}

	/**我的客户列表**/
	public static CusResource parseResource(CusResource cusResource,MyUser user) {
		List<String> list = user.getAllAuthority();
		if (list != null) {
			if (list.contains(Constant.ADMIN_AUTONE_CUSTOMER_INFO)) {
				cusResource.setTelephone(cusResource.getMobile());
				cusResource.setEmail(null);
				cusResource.setMobile(null);
				cusResource.setWechat(null);
				cusResource.setQq(null);
			}
	    }
		return cusResource;
	}

	/**解析客户阶段**/
	public static String parseCustomerStage(String stage){
		String stageReturn = "";
		switch (stage){
			case "1":
				stageReturn = "了解学生情况";
				break;
			case "2":
				stageReturn = "推荐项目";
				break;
			case "3":
				stageReturn = "解答疑问";
				break;
			case "4":
				stageReturn = "催促成交";
				break;
			default:
				stageReturn = "已成交";

		}
		return stageReturn;

	}

	/**解析大数据学历层次**/
	public static String parseBigExmEducation(String education){
		String eduName = "";
		switch (education){
			case "专科":
				eduName = "2";
				break;
			case "本科":
				eduName = "3";
				break;
			case "硕士":
				eduName = "4";
				break;
			case "博士":
				eduName = "5";
				break;
			default:
				eduName = "无对应学历层次";

		}
		return eduName;

	}


	private static String parsePhone(String num){
		String fnum = num.substring(0,3);
		String lnum = num.substring(7);
		return fnum+"****"+lnum;
	}



}
